package 曾世昌12_4;

import java.util.Scanner;

public class demo1 {
    public static void main(String[] args) throws Exception {
        String s = new Scanner( System.in ).nextLine();
        System.out.println( stringToNumber( s ) );
    }

    public static int stringToNumber(String s) throws Exception {
        int i = 0;
        if (s == null) {
            throw new Exception( "字符串不能为null" );
        }
        if (s.length() == 0) {
            throw new Exception( "字符串不能为空" );
        }
        try {
            i = Integer.parseInt( s );
        } catch (NumberFormatException e) {
            throw new Exception( "字符串转换失败" );
        }
        return i;
    }
}
